// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: "2024-11-01",

  devtools: { enabled: false },

  imports: {
    // 自动引入导出函数和导出数据
    dirs: [
      "store/**/*.{ts,js,mjs,mts}",
      "data/**/*.{ts,js,mjs,mts}",
      "hook/**/*.{ts,js,mjs,mts}",
    ],
    // presets: [
    //   // 自动引入icons
    //   {
    //     from: "@element-plus/icons-vue",
    //     imports: ["Coin", "Position", "Setting", "Search", "FullScreen", "MoreFilled", "Plus", "Delete", "DArrowLeft", "DArrowRight", "List", "Check", "View", "Clock", "Back", "Right", "Edit"],
    //   },
    // ],
  },

  // 自动导入组件，关闭路径前缀
  components: [
    {
      path: "~/components",
      pathPrefix: false,
    },
    // {
    //   path: "~/packages/components",
    //   pathPrefix: true,
    // },
  ],

  devServer: {
    port: 43001,
  },

  modules: [
    "@element-plus/nuxt",
    "nuxt-monaco-editor",
    "nuxt-lodash",
    "@pinia/nuxt",
    "@pinia-plugin-persistedstate/nuxt",
    "@nuxtjs/tailwindcss",
  ],

  // pinia 本地持久化
  piniaPersistedstate: {
    storage: "localStorage",
  },

  runtimeConfig: {
    public: {
      API_BASE: "http://127.0.0.1:43000",
    },
  },

  // 自定义插件
  plugins: [
    {
      src: "~/packages/plugin/createDirective.ts",
      // mode: "client", // 指令不能只设置client，因为template中指令在server端也会解析
    },
  ],
});
